#include "VNCClientThread.h"

CVNCClientThread::CVNCClientThread()
{
	m_lpParam = NULL;
	m_bStop = false;
}

CVNCClientThread::~CVNCClientThread()
{
	if( m_lpParam )
	{
		delete m_lpParam;
		m_lpParam = 0;
	}
	m_bStop = true;
}

bool CVNCClientThread::Init(BaseClient* lpClient,BaseSocket* socket,bool bAuth,bool bShared)
{
	if( !lpClient || !socket )
		return false;

	TClientParam lpParam = new TClientParam();
	lpParam->client = lpClient;
	lpParam->socket = socket;
	lpParam->bAuth = bAuth;
	lpParam->bShared = bShared;

	int nRet = Start((void*)m_lpParam);

	return (nRet < 0 )?false:true;
}

void CVNCClientThread::Stop()
{
	m_bStop = true;
}

void CVNCClientThread::Run( void* lpVoid )
{
	m_lpParam = (TClientParam*)lpVoid;
	if( m_lpParam == NULL )
		return;

	while( true )
	{
		if( m_bStop )
			break;
	}
}